package cn.iocoder.yudao.module.shop.dal.mysql.opthistory;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.shop.controller.admin.opthistory.vo.ShopOptHistoryPageReqVO;
import cn.iocoder.yudao.module.shop.controller.admin.opthistory.vo.ShopOptHistoryRespVO;
import cn.iocoder.yudao.module.shop.controller.admin.order.vo.ShopOrderPageReqVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.opthistory.ShopOptHistoryDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.order.ShopOrderDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface ShopOptHistoryMapper extends BaseMapperX<ShopOptHistoryDO> {
    default PageResult<ShopOptHistoryDO> selectPage(ShopOptHistoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopOptHistoryDO>()
                .eqIfPresent(ShopOptHistoryDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(ShopOptHistoryDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(ShopOptHistoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopOptHistoryDO::getId));
    }
}
